#define  _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include"heap.h"
void HeapSort(int* a, int n)
{
	for (int i = (n - 1 - 1) / 2;i >= 0;--i)
	{
		adjustDown(a, n, i);
	}
	int end = n - 1;
	while (end>0)
	{
		Swap(&a[0], &a[end]);
		adjustDown(a, end, 0);
		--end;
	}
}
int main()
{

	int a[] = { 32,50,100,70,65,60 };
	int n = sizeof(a) / sizeof(HpDataType);
	HeapSort(a, n);
	for (int i = 0;i < n;i++)
	{
		printf("%d ", a[i]);
	}
	//Heap hp;
	//
	//HeapInit(&hp, a,n );
	//for (int i = 0;i < hp._size;i++)
	//{
	//	printf("%d ", hp._a[i]);
	//}
	//HeapSort(hp, n);
	return 0;
}